package com.wxt.eventbusanalysis;

/**
 * @author wuxiaotao on 2017/7/3.
 */

public class EventBusEngine {

    public de.greenrobot.event.EventBus mEventBusOne = new de.greenrobot.event.EventBus();
    public org.greenrobot.eventbus.EventBus mEventBusTwo = new org.greenrobot.eventbus.EventBus();


    public void register(Object object) {
        if (!mEventBusOne.isRegistered(object)) {
            mEventBusOne.register(object);
        }
        if (!mEventBusTwo.isRegistered(object)) {
            mEventBusTwo.register(object);
        }

    }

    public void unRegister(Object object) {
        if (mEventBusOne.isRegistered(object)) {
            mEventBusOne.unregister(object);
        }
        if (mEventBusTwo.isRegistered(object)) {
            mEventBusTwo.unregister(object);
        }
    }

    public void post(Object object) {

        mEventBusTwo.post(object);
        mEventBusOne.post(object);
    }

}
